
package com.fx.apartment.modules.house.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.fx.apartment.common.base.BaseServiceImpl;
import com.fx.apartment.modules.house.entity.IntoHouse;
import com.fx.apartment.modules.house.vo.IntoHouseVO;
import com.fx.apartment.modules.house.mapper.IntoHouseMapper;
import com.fx.apartment.modules.house.service.IIntoHouseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 * 入住管理 服务实现类
 *
 * @author QinXueFeng
 * @since 2021-04-19
 */
@Service
public class IntoHouseServiceImpl extends BaseServiceImpl<IntoHouseMapper, IntoHouse> implements IIntoHouseService {

	@Override
	public IPage<IntoHouseVO> selectIntoHousePage(IPage<IntoHouseVO> page, IntoHouseVO intoHouse) {
		return page.setRecords(baseMapper.selectIntoHousePage(page, intoHouse));
	}

	@Override
	public boolean audit(long id, Integer status, String message) {
		//TODO 工作流推动下一跳
		boolean update = update(Wrappers.<IntoHouse>lambdaUpdate().set(IntoHouse::getStatus, status).eq(IntoHouse::getId, id));
		return update;
	}

	@Override
	public IntoHouse apply(IntoHouse intoHouse) {
		boolean save = save(intoHouse);
		if(save){
			//TODO 启动工作流
		}
		return intoHouse;
	}

}
